﻿using System.Data.Entity;

namespace MotorLibrary.DAL
{
    public class MotorDbContextFactory: IMotorDbContextFactory
    {
        private IDatabaseInitializer<MotorDbContext> _initializer;
        public MotorDbContextFactory(IDatabaseInitializer<MotorDbContext> initializer)
        {
            this._initializer = initializer;
        }

        public MotorDbContext GetInstance()
        {
            return new MotorDbContext(_initializer);
        }

        public MotorDbContext GetInstance(bool contextOwnsConnection)
        {
            return new MotorDbContext(_initializer, contextOwnsConnection);
        }
    }
}
